<LINK href="http://cms.f.itc.cn/upload/ihome/js/calendar/css/calendar.css" type="text/css" rel="stylesheet" />
<LINK href="http://cms.f.itc.cn/upload/ihome/js/calendar/css/alternate.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src='http://cms.f.itc.cn/upload/ihome/js/calendar/mootools.js'></script>
<script type="text/javascript" src='http://cms.f.itc.cn/upload/ihome/js/calendar/calendar.rc4.js'></script>
			<div class="box02_1">
				<div class="search02 clear">
				<form action="/statis/transacts" method="get">
					时间段：<input type="text" class="in2" style="width:70px;" id="begin_time" size="10" name="start" value='<{$start}>' /> <input type="text" class="in2" style="width:70px;" id="end_time" size="10" name="end" value='<{$end}>' />
					<select name="type">
					 <option value="1" <{if $type==1}>selected="true"<{/if}>>商品交易排行</option>
					 <option value="2" <{if $type==2}>selected="true"<{/if}>>商铺交易排行</option>
					</select>
					&nbsp;&nbsp;排序: <select name="sort_type">
					 <option value="goods" <{if $sort_type=='goods'}>selected="true"<{/if}>>售卖商品数</option>
					 <option value="orders" <{if $sort_type=='orders'}>selected="true"<{/if}>>付款订单数</option>
					 <option value="money" <{if $sort_type=='money'}>selected="true"<{/if}>>金额</option>
					</select>
					<input type="submit" value="查询" />
				</form>
				</div>
				<{if $type==1}>
				<span style="font-size:16px;">商品交易排行：</span>
                <div class="box02_Tab">
                	<div class="table01">
                    	<table cellpadding="0" cellspacing="0" width="100%" border="0" id="table">
                        <tr class="th">
                        <th><div>商品名称</div></th>
                        <th><div>店铺名称</div></th>
						<th><div>售卖数量</div></th>
						<th><div>金额(元)</div></th>
						<th><div>订单数</div></th>
						<th><div>买家数</div></th>
                        </tr>
						<{foreach from=$goods_data item=item}>
						<tr>
   						<td width="40%"><a href="<{$item.goods_url}>" target="_blank"><{$item.title}></a></td>
						<td width="15%"><a href="/orders/list?merchant_id=<{$item.merchant_uid}>" target="_blank"><{$item.shop_name}></a></td>
						<td width="15%"><a href="javascript:void(0);" onclick="go_to('<{$item.title}>');"><{$item.goods}></a></td>
						<td width="15%"><{$item.money}></td>
						<td width="8%"><a href="javascript:void(0);" onclick="go_to('<{$item.title}>');"><{$item.orders}></a></td>
						<td width="7%"><{$item.buyers}></td>
						</tr>
						<{/foreach}>
                        </table>
                    </div>
                </div>
				<{$pagination}>
				<script>
				function go_to(title)
				{
					var new_title =	encodeURIComponent(title);	

					var url	= '/orders/list?goods_name='+ new_title +'&create_time_greater=<{$begin_time}>&create_time_less=<{$end_time}>&pay_status[]=paid&pay_status[]=sent&pay_status[]=received'; 

					window.location.href = url;
				}
				</script>
				<{/if}>
				<{if $type==2}>
				<span style="font-size:16px;">商铺交易排行：</span>
                <div class="box02_Tab">
                	<div class="table01">
                    	<table cellpadding="0" cellspacing="0" width="100%" border="0" id="table">
                        <tr class="th">
                        <th><div>商铺名称</div></th>
                        <th><div>付款订单数</div></th>
						<th><div>金额</div></th>
                        <th><div>售出商品数</div></th>
						<th><div>买家数</div></th>
						</tr>
						<{foreach from=$shops_data item=items}>
						<tr>
   						<td width="50%"><a href="/orders/list?merchant_id=<{$items.merchant}>" target="_blank"><{$items.shop_name}></a></td>
						<td width="20%"><a href="/orders/list?merchant_id=<{$items.merchant}>&pay_status[0]=paid&pay_status[1]=sent&pay_status[2]=received&<{foreach from=$refund_status item=status key=k}>&pay_status[<{$k+3}>]=<{$status}><{/foreach}>&create_time_greater=<{$begin_time}>&create_time_less=<{$end_time}>"><{$items.orders}></a></td>
						<td width="10%"><{$items.money}></td>
						<td width="10%"><{$items.goods}></td>
						<td width="10%"><{$items.buyers}></td>
						</tr>
						<{/foreach}>
                        </table>
                    </div>
                </div>
				<{$pagination}>
				<{/if}>
<script>
window.addEvent('domready', function() {
	myCal = new Calendar({ begin_time: 'Y-m-d'},{classes:['alternate'],navigation:2,tweak:{x:0,y:-20}});
	myCal = new Calendar({ end_time: 'Y-m-d'},{classes:['alternate'],navigation:2,tweak:{x:0,y:-20}});

	$begin_str = '<{$begin_time}>';
	var begin_time = $('begin_time');
	if (begin_time.value == '') begin_time.value = $begin_str;
		begin_time.onfocus = function() {
		this.className = 'in1';
		if(this.value == $begin_str) this.value='';        
	}
	begin_time.onblur = function() {
		this.className='in2';
		if(this.value=='') this.value = $begin_str;
	}

	$end_str = '<{$end_time}>';
	var end_time = $('end_time');
	if (end_time.value == '') end_time.value = $end_str;
	end_time.onfocus = function() {
	this.className = 'in1';
	if(this.value == $end_str) this.value='';        
	}
	end_time.onblur = function() {
	this.className='in2';
	if(this.value=='') this.value = $end_str;
	}
																								 
});

</script>

